In [1]:
import copy
import cPickle
import os
import subprocess
import cdpybio as cpb
import matplotlib as mpl
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
pd.options.mode.chained_assignment = None # default='warn'
import pybedtools as pbt
import scipy.stats as stats
import seaborn as sns
import ciepy
import cardipspy as cpy
%matplotlib inline
dy_name = 'table_peqtns'
outdir = os.path.join(ciepy.root, 'output', dy_name)
cpy.makedir(outdir)
private_outdir = os.path.join(ciepy.root, 'private_output', dy_name)
cpy.makedir(private_outdir)
import socket
if socket.gethostname() == 'fl-hn1' or socket.gethostname() == 'fl-hn2':
dy = os.path.join(ciepy.root, 'sandbox', 'tmp', dy_name)
cpy.makedir(dy)
pbt.set_tempdir(dy)
In [2]:
fn = os.path.join(ciepy.root, 'output', 'fine_mapping', 'peqtns.tsv')
peqtns = pd.read_table(fn, index_col=0)
fn = os.path.join(ciepy.root, 'output', 'fine_mapping', 'encode_tf_chip_seq.tsv')
tf_overlap = pd.read_table(fn, index_col=0)
fn = os.path.join(ciepy.root, 'output', 'fine_mapping', 'motif_disruption.tsv')
motif_disrupt = pd.read_table(fn, index_col=0)
fn = os.path.join(ciepy.root, 'output', 'fine_mapping', 'tf_disruption.tsv')
tf_disrupt = pd.read_table(fn, index_col=0)
In [3]:
peqtns = peqtns.drop(['nmd_percent_transcripts_nmd', 'nmd_num_transcripts'], axis=1)
peqtns = peqtns[peqtns.columns[0:27]]
peqtns = peqtns.drop('genocnt', axis=1)
In [4]:
writer = pd.ExcelWriter(os.path.join(outdir, 'peqtns.xlsx'))
peqtns.to_excel(writer, 'peQTNS')
tf_overlap.ix[peqtns.location].to_excel(writer, 'tf_peak_overlap')
motif_disrupt.ix[peqtns.location].to_excel(writer, 'motif_disrupt')
tf_disrupt.ix[peqtns.location].to_excel(writer, 'tf_disrupt')
writer.save()